package zwyarraylist;

import java.util.ArrayList;

import org.junit.Test;

public class ArrayList06Test {

	
	/**
	* 558行
	* @title: test 
	* @Author: zhaoweiyong
	* @Date: 2017年7月6日下午2:50:59
	 */
	@Test
	public void testAddAll(){
		ArrayList<String> oldList0 = new ArrayList<String>();
		oldList0.add("1");
		oldList0.add("2");
		
		ArrayList<String> oldList1 = new ArrayList<String>();
		oldList1.add("-1");
		oldList1.add("0");
		
		ArrayList<String> newList = new ArrayList<String>();
		newList.add("-2");
		//
		//2、扩容 size + numNew ,modCount更改
		//3、 System.arraycopy(a, 0, elementData, size, numNew) 复制数据到新的数组
		//4、size = size + numNew
		//5、返回boolean
		newList.addAll(oldList0);
		//
		//rangeCheckForAdd
		//扩容
		//移动size - index
		//复制
		newList.addAll(1, oldList1);
		System.out.println(newList);
		
//		newList.removeAll(oldList0);
//		System.out.println(newList);
		
		newList.retainAll(oldList0);
		System.out.println(newList);
		
		newList.iterator();
		newList.listIterator();
		newList.subList(0, 2);//2个长度
	}
	
	
}
